import 'package:flutter/material.dart';

void main() {
  // runApp(const Center(
  //   child: Text(
  //     'Hello World',
  //     textDirection: TextDirection.ltr, // 文字方向
  //     style: TextStyle(
  //       color: Colors.green,
  //       fontSize: 40,
  //       fontWeight: FontWeight.bold,
  //     ),
  //     maxLines: 1,
  //   ),

  // ));

  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text('标题'),
        leading: const Icon(Icons.menu),
        centerTitle: true, // 标题居中
        elevation: 0.3, // 阴影
        backgroundColor: Colors.black12,
        actions: <Widget>[
          IconButton(
            icon: const Icon(Icons.settings),
            onPressed: () {},
          ),
        ],
      ),
      body: const MyApp(),
    ),
  ));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key, age=18});
  final age = 18;

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Text('今年$age岁'),
    );
  }
}
